
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> #################################################################
> # "Democracy, Inequality and Antitrust"                         #
> #   By Michael O Allen, Kenneth Scheve, and David Stasavage     #
> #                                                               #
> #   This file:                                                  #
> #   Replication code for Figure 4                               #
> #                                                               #
> #   Last modified: 12/19/2024                                   #
> #################################################################
> 
> library(ggplot2)
> library(data.table)
data.table 1.15.0 using 1 threads (see ?getDTthreads).  Latest news: r-datatable.com
**********
This installation of data.table has not detected OpenMP support. It should still work but in single-threaded mode.
This is a Mac. Please read https://mac.r-project.org/openmp/. Please engage with Apple and ask them for support. Check r-datatable.com for updates, and our Mac instructions here: https://github.com/Rdatatable/data.table/wiki/Installation. After several years of many reports of installation problems on Mac, it's time to gingerly point out that there have been no similar problems on Windows or Linux.
**********
> 
> library(here)
here() starts at /Users/moda/Desktop/democracy inequality antitrust jop desk
> 
> # Figure 5a - Clayton Act plot  -------------------------------------------
> 
> fullData <- haven::read_dta(here('data', 'clayton_votes.dta'))
> setDT(fullData)
> 
> set.seed(1)
> ggplot(fullData[!is.na(vote)], aes(factor(vote), top1Share)) +
+   geom_violin(draw_quantiles = c(0.25, 0.75),
+               linetype = 'dashed') +
+   geom_violin(draw_quantiles = c(0.5),
+               fill = 'transparent') +
+   geom_jitter(height = 0, width = 0.1, 
+               size = 2.5,
+               stroke = 0,
+               aes(color = factor(democrat),
+                   shape = factor(democrat))) +
+   scale_color_manual(values = c('red', 'blue')) +
+   scale_y_continuous(label = scales::percent_format(1L)) +
+   scale_x_discrete(labels = c('Against', 'For\n(Strengthen Antitrust)')) +
+   theme_bw(base_size = 16) +
+   labs(x = element_blank(),
+        y = 'Top 1% Income Share') +
+   theme(panel.grid.major.x = element_blank(),
+         panel.grid.minor.x = element_blank(),
+         axis.text = element_text(colour = 'black'),
+         legend.position = 'none')
> 
> ggsave(here('output', 'figures', 'figure-4a.png'),
+        width = 5, height = 4, units = "in", dpi = 450)
> 
>  rm(fullData)
> 
> # Figure 5b - Webb-Pomerene Act Plot --------------------------------------
> 
> fullData <- haven::read_dta('data/webb_votes.dta')
> setDT(fullData)
> 
> set.seed(1)
> ggplot(fullData[!is.na(vote)], aes(factor(vote), top1Share)) +
+   geom_violin(draw_quantiles = c(0.25, 0.75),
+               linetype = 'dashed') +
+   geom_violin(draw_quantiles = c(0.5),
+               fill = 'transparent') +
+   geom_jitter(height = 0, width = 0.1, 
+               size = 2.5,
+               stroke = 0,
+               aes(color = factor(democrat),
+                   shape = factor(democrat))) +
+   scale_color_manual(values = c('red', 'blue')) +
+   scale_y_continuous(label = scales::percent_format(1L)) +
+   scale_x_discrete(labels = c('Against', 'For\n(Weaken Antitrust)')) +
+   theme_bw(base_size = 16) +
+   labs(x = element_blank(),
+        y = '') +
+   theme(panel.grid.major.x = element_blank(),
+         panel.grid.minor.x = element_blank(),
+         axis.text = element_text(colour = 'black'),
+         legend.position = 'none')
> 
> ggsave(here('output', 'figures', 'figure-4b.png'),
+        width = 5, height = 4, units = "in", dpi = 450)
> 
> rm(fullData)